﻿namespace WLFramework.Data
{
    using System;

    /// <summary>
    /// Column标识属性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class ColumnAttribute : Attribute
    {
        /// <summary>
        /// Column名称
        /// </summary>
        public string ColumnName { get; set; }

        /// <summary>
        /// 是否为主键
        /// </summary>
        public bool IsPrimaryKey { get; set; }
        
        /// <summary>
        /// 是否由数据库自动生成
        /// </summary>
        public bool IsDbGenerated { get; set; }

        /// <summary>
        /// 是否允许为空
        /// </summary>
        public bool IsDbNull { get; set; }

        /// <summary>
        /// 构建Column标识属性
        /// </summary>
        public ColumnAttribute()
        { 
        }

        /// <summary>
        /// 构建Column标识属性
        /// </summary>
        /// <param name="ColumnName">Column名称</param>
        public ColumnAttribute(string ColumnName)
        {
            this.ColumnName = ColumnName;
        }
    }
}
